//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.base;

import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;

public class OrderSet {
    public static final String ASC = "asc";
    public static final String DESC = "desc";
    private HashMap<String, String> orderMap = new LinkedHashMap();

    public OrderSet() {
    }

    public OrderSet asc(String name) {
        this.orderMap.put(name, "asc");
        return this;
    }

    public OrderSet desc(String name) {
        this.orderMap.put(name, "desc");
        return this;
    }

    private OrderSet clear() {
        this.orderMap.clear();
        return this;
    }

    public String toSql() {
        StringBuilder sql = new StringBuilder();
        int n = 0;

        String k;
        for(Iterator i$ = this.orderMap.keySet().iterator(); i$.hasNext(); sql.append(k + " " + (String)this.orderMap.get(k))) {
            k = (String)i$.next();
            if(n++ > 0) {
                sql.append(", ");
            }
        }

        if(sql.length() > 0) {
            sql.insert(0, " order by ");
        }

        return sql.toString();
    }
}
